﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThinhTien.Data.Repository;

namespace ThinhTien.Common
{
    public static class LookupData
    {
        private static List<KeyValuePair<int, string>> waranties;
        public static List<KeyValuePair<int, string>> Waranties
        {
            get
            {
                if (waranties == null)
                {
                    waranties = new List<KeyValuePair<int, string>>();
                    waranties.Add(new KeyValuePair<int, string>(3, "3 tháng"));
                    waranties.Add(new KeyValuePair<int, string>(6, "6 tháng"));
                    waranties.Add(new KeyValuePair<int, string>(12, "12 tháng"));
                    waranties.Add(new KeyValuePair<int, string>(24, "24 tháng"));
                    waranties.Add(new KeyValuePair<int, string>(36, "36 tháng"));
                }

                return waranties;
            }
        }

        private static KeyValuePair<Guid, string>[] categories;

        public static KeyValuePair<Guid, string>[] Categories
        {
            get
            {
                categories = GetparentCategorys();

                return categories;
            }
        }

        private static KeyValuePair<Guid, string>[] GetparentCategorys()
        {
            var department = new CategoryRepository();
            return department.GetCategories();
        }

        private static KeyValuePair<Guid, string>[] types;

        public static KeyValuePair<Guid, string>[] Types
        {
            get
            {
                types = GetLookup(LookupType.Slide);

                return types;
            }
        }

        private static KeyValuePair<Guid, string>[] GetLookup(LookupType type)
        {
            var lookup = new LookupRepository();
            return lookup.GetDataLookup(type.ToString());
        }

        private static KeyValuePair<Guid, string>[] category;

        public static KeyValuePair<Guid, string>[] Category
        {
            get
            {
                category = GetCategoriesNonDeleted();

                return category;
            }
        }

        private static KeyValuePair<Guid, string>[] GetCategoriesNonDeleted()
        {
            var department = new CategoryRepository();
            return department.GetCategory();
        }
    }

}
